function InitializePlayerDataHashTable takes player whichPlayer returns nothing
	local hashtable ownerAvailableAbilityTable = InitHashtable()
	local hashtable ownerPreferAbilityTable =  InitHashtable()
	//--
	call SaveHashtableHandle(udg_PlayerDataHashTable , GetHandleId(whichPlayer) , StringHash("ABILITY_AVAILABLE_TABLE") , ownerAvailableAbilityTable)
	call SaveHashtableHandle(udg_PlayerDataHashTable , GetHandleId(whichPlayer) , StringHash("PREFER_ABILITY_TABLE") , ownerPreferAbilityTable)
	
	//鏟子
	call SaveBoolean(ownerAvailableAbilityTable , 'A00L' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("SHOVEL") , StringHash("E") , 'A00L')
	
	//匕首
	call SaveBoolean(ownerAvailableAbilityTable , 'A01W' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("DAGGER") , StringHash("E") , 'A01W')
	call SaveInteger(ownerPreferAbilityTable , StringHash("DAGGER") , StringHash("Q") , 'A01X')
	call SaveInteger(ownerPreferAbilityTable , StringHash("DAGGER") , StringHash("W") , 'A01Y')
	
	//雙手武器
	call SaveBoolean(ownerAvailableAbilityTable , 'A01K' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("TWO_HANDED") , StringHash("E") , 'A01K')
	call SaveInteger(ownerPreferAbilityTable , StringHash("TWO_HANDED") , StringHash("Q") , 'A020')
	call SaveInteger(ownerPreferAbilityTable , StringHash("TWO_HANDED") , StringHash("W") , 'A021')
	
	//盾牌
	call SaveBoolean(ownerAvailableAbilityTable , 'A022' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("SHIELD") , StringHash("E") , 'A022')	
	call SaveInteger(ownerPreferAbilityTable , StringHash("SHIELD") , StringHash("Q") , 'A01N')	
	call SaveInteger(ownerPreferAbilityTable , StringHash("SHIELD") , StringHash("W") , 'A023')	
	
	//手槍
	call SaveBoolean(ownerAvailableAbilityTable , 'A00O' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("PISTOL") , StringHash("E") , 'A00O')
	
	//散彈槍
	call SaveBoolean(ownerAvailableAbilityTable , 'A01L' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("SHOTGUN") , StringHash("E") , 'A01L')
	
	//狙擊槍
	call SaveBoolean(ownerAvailableAbilityTable , 'A015' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("SNIPER_RIFLE") , StringHash("E") , 'A015')
	
	//雷射步槍
	call SaveBoolean(ownerAvailableAbilityTable , 'A012' , StringHash("LEARNED") , true)
	call SaveInteger(ownerPreferAbilityTable , StringHash("LASER_RIFLE") , StringHash("E") , 'A012')
	
	//--
endfunction

function DisablePlayerAbilities takes player whichPlayer returns nothing
	call SetPlayerAbilityAvailable(whichPlayer , 'A00O' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A015' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A012' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A00L' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A00N' , false)
	
	call SetPlayerAbilityAvailable(whichPlayer , 'A01L' , false)
	
	
	//匕首
	call SetPlayerAbilityAvailable(whichPlayer , 'A01W' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A01X' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A01Y' , false)
	
	//雙手武器
	call SetPlayerAbilityAvailable(whichPlayer , 'A01K' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A020' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A021' , false)
	
	//盾牌
	call SetPlayerAbilityAvailable(whichPlayer , 'A022' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A01N' , false)
	call SetPlayerAbilityAvailable(whichPlayer , 'A023' , false)
	
endfunction

function InitPlayer takes nothing returns nothing
	local player whichPlayer = GetEnumPlayer()
	local unit survivor = null
	//--
	if GetPlayerController(whichPlayer) == MAP_CONTROL_USER and GetPlayerSlotState(whichPlayer) == PLAYER_SLOT_STATE_PLAYING then
		set udg_AmountOfPlayers = udg_AmountOfPlayers + 1
		call ForceAddPlayer(udg_PlayerForce , whichPlayer)
		set survivor = CreateUnit(whichPlayer , 'h000' , GetLocationX(udg_TempLocation) , GetLocationY(udg_TempLocation) , GetRandomReal(0.0 , 360.0))
		set udg_Survivors[GetPlayerId(whichPlayer)] = survivor
		if GetLocalPlayer() == whichPlayer then
			call SelectUnit(survivor , true)
		endif
		call PanCameraToTimedLocForPlayer(whichPlayer , udg_TempLocation , 0.0)
		call SetCameraTargetControllerNoZForPlayer(whichPlayer , survivor , 0.0 , 0.0 , false)
		call DisablePlayerAbilities(whichPlayer)
		call InitializePlayerDataHashTable(whichPlayer)
		call IssueTargetOrder(survivor , "smart" , CreateItemLoc('I002' , udg_TempLocation))
	endif
	//--
	set whichPlayer = null
	set survivor = null
endfunction

function DestructableNearEnum takes nothing returns nothing
    set udg_TempBoolean = true
endfunction

function InitTrig_PlayerForce takes nothing returns nothing
	loop
		set udg_TempBoolean = false
		set udg_TempLocation = GetRandomLocInRect(bj_mapInitialPlayableArea)
		call EnumDestructablesInCircleBJ(200.0 , udg_TempLocation , function DestructableNearEnum)
		exitwhen udg_TempBoolean == false
		call RemoveLocation(udg_TempLocation)
	endloop
	call ForForce(GetPlayersAll() , function InitPlayer )
	call RemoveLocation(udg_TempLocation)
endfunction